home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 8
/
QRZ Ham Radio Callsign Database - Volume 8.iso
/
mac
/
files
/
morse
/
morsetst.bas
< prev
next >
Wrap
BASIC Source File
|
1996-06-25
|
7KB
|
238 lines
10 ' A BASIC CODE TRAINER - KH6FHN/4 BOX 3292, MCLEAN VA 22103
20 ' TAKEN FROM "COMPUTER TRADER" ISSUE OF JULY, 1984
30 ' MODIFICATIONS BY N6MPP (GILLMANN@ISIB.ARPA)
40 ' PROGRAM SPEED VARIES AMONG BASIC BASICA BASCOM AND AMONG PC/AT/PCJR
45 ' SET CONSTANT M5 TO ADJUST FOR THIS
50 RANDOMIZE TIMER
60 O=VAL(MID$(TIME$,7,2))+10*VAL(MID$(TIME$,4,2))
70 FOR I=1 TO O : R=RND : NEXT I
80 DIM A$(100)
90 HBNDA = 44
100 REM SINGLE
110 A$(1) = "E."
120 A$(2) = "T-"
130 REM DOUBLE
140 A$(3) = "A.-"
150 A$(4) = "I.."
160 A$(5) = "M--"
170 A$(6) = "N-."
180 REM TRIPLE
190 A$(7) = "D-.."
200 A$(8) = "G--."
210 A$(9) = "K-.-"
220 A$(10) = "O---"
230 A$(11) = "R.-."
240 A$(12) = "S..."
250 A$(13) = "U..-"
260 A$(14) = "W.--"
270 REM QUADRUPLE
280 A$(15) = "B-..."
290 A$(16) = "C-.-."
300 A$(17) = "F..-."
310 A$(18) = "H...."
320 A$(19) = "J.---"
330 A$(20) = "L.-.."
340 A$(21) = "P.--."
350 A$(22) = "Q--.-"
360 A$(23) = "V...-"
370 A$(24) = "X-..-"
380 A$(25) = "Y-.--"
390 A$(26) = "Z--.."
400 REM QUINTUPLE
410 A$(27) = "0-----"
420 A$(28) = "1.----"
430 A$(29) = "2..---"
440 A$(30) = "3...--"
450 A$(31) = "4....-"
460 A$(32) = "5....."
470 A$(33) = "6-...."
480 A$(34) = "7--..."
490 A$(35) = "8---.."
500 A$(36) = "9----."
510 A$(37) = "/-..-." ' DN
520 A$(38) = "=-...-" ' BT
530 A$(39) = "a.-.-." ' AR
540 REM SEXTUPLE
550 A$(40) = "..-.-.-"
560 A$(41) = ",--..--"
570 A$(42) = "?..--.."
580 A$(43) = "s...-.-" ' SK
590 REM SPECIAL (NOT ON GENERAL TEST)
600 A$(44) = "~.-...-" ' NEW LINE
610 REM START OF CODE TRAINER PROGRAM
620 CLS
630 M5 = 20 ' BASIC SPEED CONSTANT = MAX WPM, BASICA=13 BASIC=15 BASCOM=20
640 F = 837 ' TONE FREQ. IN HZ. FCC SAYS 700 TO 1000 HZ.
650 PRINT "KH6FHN CODE SENDER, MODIFIED BY N6MPP 1985"
660 PRINT "ENTER T FOR TABLE, M FOR MEMORY TEST, P FOR PRACTICE";
670 INPUT S$
680 IF (S$ = "P") OR (S$ = "P") GOTO 930
690 IF (S$ = "M") OR (S$ = "m") GOTO 1820
700 PRINT
710 PRINT "A .- S ... . .-.-.-"
720 PRINT "B -... T - , --..--"
730 PRINT "C -.-. U ..- ? ..--.."
740 PRINT "D -.. V ...- / -..-. (DN)"
750 PRINT "E . W .-- = -...- (BT = DOUBLE DASH)"
760 PRINT "F ..-. X -..- a .-.-. (AR = END OF MESSAGE)"
770 PRINT "G --. Y -.-- s ...-.- (SK = END OF CONTACT)"
780 PRINT "H .... Z --.. ~ .-...- (NEW LINE)"
790 PRINT "I .. 0 -----"
800 PRINT "J .--- 1 .----"
810 PRINT "K -.- 2 ..---"
820 PRINT "L .-.. 3 ...--"
830 PRINT "M -- 4 ....-"
840 PRINT "N -. 5 ....."
850 PRINT "O --- 6 -...."
860 PRINT "P .--. 7 --..."
870 PRINT "Q --.- 8 ---.."
880 PRINT "R .-. 9 ----."
890 PRINT
900 PRINT "(PRESS ANY KEY TO CONTINUE)"
910 IF INKEY$ = "" THEN 910
920 GOTO 610
930 REM PRACTICE
940 PRINT USING "ENTER DESIRED CODE SPEED 5-##";M5;
950 INPUT T1
960 IF T1 < 5 THEN 930
970 IF T1 > M5 THEN 930
980 T = M5 / T1
990 IF T1 <= 12 THEN T = M5 / (T1 - 1)
1000 IF T1 <= 11 THEN T = M5 / (T1 - 2)
1010 IF T1 <= 9 THEN T = M5 / (T1 - 3)
1020 T13 = T
1030 IF T1 < 13 THEN T13 = M5 / 13
1040 REM HERE WE CAN ALSO ENTER TONE FREQ. F (HZ)
1050 PRINT "ENTER K TO SEND FROM KBD, F TO SEND A FILE, R FOR RANDOM";
1060 INPUT S$
1070 IF (S$ = "K") OR (S$ = "k") THEN GOSUB 1460
1080 IF (S$ = "F") OR (S$ = "f") THEN GOSUB 1110
1090 IF (S$ = "R") OR (S$ ="r") THEN GOSUB 1530
1100 GOTO 620
1110 REM FILE SEND
1120 PRINT "ENTER THE FILE TO SEND";
1130 INPUT DSNAME$
1140 OPEN DSNAME$ FOR INPUT AS 1
1142 PRINT "(PRESS ANY KEY WHEN READY)"
1143 T = 1.4*T ' MORE FUDGE
1144 GOSUB 2190 : T0 = O ' TIME IN SECONDS
1146 S = 0
1148 IF INKEY$ = "" THEN 1144
1150 IF EOF(1) THEN 1250
1160 LINE INPUT # 1, REC$
1170 LL = LEN(REC$)
1180 FOR L1 = 1 TO LL
1190 C$ = MID$(REC$, L1, 1)
1195 S = S + 1 : IF C$ > "Z" THEN S = S + 1
1200 GOSUB 1270 ' GEN MORSE
1210 NEXT L1
1220 C$ = " " : GOSUB 1270
1230 PRINT
1240 GOTO 1150
1250 CLOSE # 1 : PRINT
1252 GOSUB 2190 : O = O - T0
1255 PRINT USING "ACTUAL WPM BY FCC STANDARDS = ##.#";(S/O)*12
1257 PRINT "(PRESS ANY KEY TO CONTINUE)"
1258 IF INKEY$ = "" THEN 1258
1260 RETURN ' FILE LIST
1270 REM GENERATE MORSE FOR CHARACTER C$ AT RATE T.
1280 FOR J = 1 TO HBNDA
1290 IF MID$(A$(J), 1, 1) = C$ THEN GOSUB 1360 ' MAKE SOUND
1300 NEXT J
1310 IF F = 838 THEN RETURN
1320 IF C$ = " " THEN SOUND 32767, T*4
1330 IF C$ = "~" THEN PRINT " "
1340 IF C$ <> "~" THEN PRINT C$;
1350 RETURN ' END GENERATE MORSE
1360 REM MAKE SOUND
1370 K = LEN(A$(J))
1380 FOR L = 2 TO K
1390 SL = 1
1400 IF MID$(A$(J), L, 1) = "-" THEN SL = 3
1410 SOUND F, T13*SL
1420 SOUND 32767, T13 ' SPACE
1430 NEXT L
1440 SOUND 32767,3*T-T13
1450 RETURN
1460 REM KEYBOARD
1470 PRINT "ENTER * TO END KEYBOARD MODE"
1480 C$ = INKEY$
1490 IF C$ = "" THEN 1480
1500 IF C$ = "*" THEN RETURN
1510 GOSUB 1270
1520 GOTO 1480
1530 REM RANDOM
1540 PRINT "TEST WILL LAST 5 MINUTES"
1550 PRINT "STRIKE ANY KEY WHEN READY"
1560 PRINT
1570 T0=RND : IF INKEY$ = "" THEN 1570
1580 GOSUB 2190 : T0 = O ' TIME IN SECONDS
1590 S = 0 : S0 = 0
1600 Z = 7
1610 GOSUB 2110
1620 I = 0
1630 C$ = INKEY$
1640 IF C$ <> "" THEN 1780
1650 GOSUB 2190 : IF O > T0+300 THEN 1760
1660 I = I + 1
1670 C$ = " "
1680 IF I = INT(I/6)*6 THEN 1730 ' GROUPS OF FIVE
1690 K = INT(RND*Z1)+1
1700 IF K>26 THEN IF VAL(MID$(TIME$,7,2))<15 THEN K = INT(RND*26)+1
1710 C$ = MID$(A$(K), 1, 1)
1720 S0 = S0 + 1 : S = S + 1 : IF K > 26 THEN S = S + 1
1730 GOSUB 1270 ' TOOT TOOT!
1740 IF I = INT(I/24)*24 THEN PRINT ' FOUR GROUPS
1750 GOTO 1630
1760 PRINT : IF I <> INT(I/24)*24 THEN PRINT
1770 PRINT USING "### CHARS AT ACTUAL WPM BY FCC STANDARDS OF ##.#";S0,S/25
1780 PRINT "(PRESS ANY KEY TO CONTINUE)"
1790 C$ = INKEY$
1800 IF C$ = "" THEN 1790
1810 RETURN[
1820 REM MEMORY TEST
1830 T1=13 ' WPM
1840 T=M5/T1
1850 T13=T
1860 F = 838
1870 Z=4 ' INITIAL MAX LENGTH OF SYMBOLS
1880 S=0
1890 FOR J9=1 TO 10
1900 E=0
1910 GOSUB 2110
1920 FOR I=1 TO 10
1930 K9 = INT(RND*Z1)+1
1940 B$ = A$(K9)
1950 C$ = MID$(B$, 1, 1)
1960 GOSUB 1270
1970 PRINT USING "### : ";10*(J9-1)+I;
1980 S$ = INKEY$ : IF S$ = "" THEN 1980
1990 PRINT S$;
2000 IF S$=C$ THEN S=S+1 : PRINT " RIGHT!"
2010 IF S$<>C$ THEN E=E+1 : PRINT " WRONG, IT'S ",B$
2020 NEXT I
2030 IF E=0 THEN Z=Z+1
2040 IF Z>6 THEN Z=6
2050 IF E>1 THEN Z=Z-1
2060 NEXT J9
2070 PRINT "YOUR SCORE WAS ",S
2080 PRINT "(PRESS ANY KEY TO CONTINUE)"
2090 IF INKEY$ = "" THEN 2090
2100 GOTO 610
2110 REM SUBR TO GET MAX CHAR LEN --- Z1
2120 IF Z>= 6 THEN Z1 = 43
2130 IF Z = 5 THEN Z1 = 39
2140 IF Z = 4 THEN Z1 = 26
2150 IF Z = 3 THEN Z1 = 14
2160 IF Z = 2 THEN Z1 = 6
2170 IF Z<= 1 THEN Z1 = 2
2180 RETURN
2190 REM TIMER SUBROUTINE
2200 X$=TIME$
2210 O1$=MID$(X$,1,2)
2220 O2$=MID$(X$,4,2)
2230 O3$=MID$(X$,7,2)
2240 O=VAL(O1$)*3600+VAL(O2$)*60+VAL(O3$)
2250 RETURN
2260 END